<!DOCTYPE html>
<html>
<head>
		<meta charset="UTF-8">
		<title>扫码</title>
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta http-equiv="Cache-Control" content="no-transform">
		<meta name="format-detection" content="telephone=no">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<link rel="stylesheet" href="style/css/basic.css" />
		<link rel="stylesheet" href="style/plugin/mui/css/mui.min.css" />
		<link rel="stylesheet" href="style/css/dealer.css" />
		<link rel="stylesheet" href="style/css/verification.css" />
		<script type="text/javascript" src="style/plugin/mui/js/mui.min.js"></script>
		<script type="text/javascript" src="style/js/jquery-1.8.3.min.js"></script>
		<script type="text/javascript" src="style/mockjs/dist/mock.js"></script>
		<script type="text/javascript" src="style/js/vue.min.js"></script>
		<script type="text/javascript" src="style/js/vue-resource.js"></script>
		<script type="text/javascript" src="style/js/basic.js"></script>
		<style>
			.ser{
				background: #007AFF;
				margin: 5px;
				width:60px;  
				height:40px;
				border:none;
				color:#F4E7E4
			}
			#header h1{
				margin-top:18px !important;
			}
		</style>
	</head>                                                                
	<body>
        <div id="sss">
			<div id="header"><!--id="search_input"-->
				<!--<input id='account' type="text" v-model="serchAgent" placeholder="输入经销商昵称"/>
				<button class="ser" @tap="ser">搜索</button>-->
				<h1>核销</h1>
			</div> 
			<div class="content body" id="refreshContainer"> 
				<ul class="list">
					<li v-for="(agm,index) in agentMsg" @tap="jumpdetail(index)">
						<a href="javascript:;">
							<div class="list_left">
								<img :src="htp+agm.head"/> 
							</div>
							<div class="list_right_text">
								<span>{{agm.nickname}}</span>
								<span>未核销：{{agm.order_total.check_num}}瓶</span> 
							</div> 
						</a>
					</li>
				</ul>
			</div>
        </div>  
		<!--footer-->
		<div id="footer">
			<ul class="clearfix">
				<li>
					<a href='sales_in_bound.html'><i class="icon_scan"></i><span>待入库</span></a>
				</li>
				<li>
					<a href="sales_verification.html" target="_blank"><i class="icon_verification"></i><span class="active_color">核销</span></a>
				</li>
				<li>
					<a href='sales_integral_mall.html' target="_blank"><i class="icon_integral"></i><span>积分</span></a>
				</li>
				<li>
					<a href='sales_my.html' target="_blank"><i class="icon_my"></i><span>我的</span></a>
				</li>
			</ul>
		</div>
		<script>
			new Vue({
				el:"#sss",
				data:{
					agentMsg:"",
					serchAgent:"",
					htp:"",
					ticket:"",
				    sign:""
				},
				methods:{
					jumpdetail:function(dIndex){
						openurl_can("sales",this.agentMsg[dIndex].mem_no)
					},
					ser:function(){
					    this.$http.post(domain+"/saler/getAgentList?t="+this.ticket+"&sign="+this.sign,{
					      	page:1,
					      	keyword:this.serchAgent
					      },{emulateJSON:true}).then(
				            function (res) {
				                // 处理成功的结果
				                console.log(res.body)
				                if(res.body.code==1){
				                  this.agentMsg=res.body.data;
				                  if(res.body.data.length==0){
				                	mui.toast("没有该经销商")
				                  }
				                }else{
				                	mui.toast("暂无商品")
				                }
				            },function (res) {
				            // 处理失败的结果
				            console.log(res) 
				            }
				        )	
					} 
				}, 
				created:function(){
					this.ticket=localStorage.getItem("tick")
                    this.sign=localStorage.getItem("sig")
//					this.$http.post(domain+"/saler/getAgentList?t="+this.ticket+"&sign="+this.sign,{
//					      	page:1,
//					      	keyword:this.serchAgent
//					      },{emulateJSON:true}).then(
//				            function (res) {
//				                // 处理成功的结果
//				                console.log(res.body)
//				                if(res.body.code==1){
//				                  this.agentMsg=res.body.data;
//				                  if(res.body.data.length==0){
//				                	mui.toast("没有该经销商")
//				                  }
//				                }else{
//				                	mui.toast("暂无商品")
//				                }
//				            },function (res) {
//				            // 处理失败的结果
//				            console.log(res) 
//				            }
//				        )
				},
				mounted:function(){
					this.htp=domain2
					var p=1;
					var that=this; 
					mui.plusReady(function(){
						mui.init({
						  pullRefresh : {
						    container:"#refreshContainer",
						    down : {
						      style:'circle',
						      color:'#2BD009',
						      height:'50px',
						      range:'100px',
						      offset:'0px', 
						      contentdown:null,
						      auto: true, 
						      callback :pullrefesh  	      
						    }
						  } 
						}); 
					    function pullrefesh(){
							that.$http.post(domain+"/saler/getAgentList",{
							      	page_id:p++,
							      	page_size:2
							      },{emulateJSON:true}).then(
						            function (res) {
						                // 处理成功的结果
						                console.log(res.body)
						                if(res.body.code==1){
		                                    if(res.body.data.list.length==0){
							                	mui.toast("没有更多了")
							                	return false;
							                }
						                    that.agentMsg=res.body.data.list;
						                 
						                }else{
						                	mui.toast("暂无商品")
						                }
						            },function (res) {
						            // 处理失败的结果
						            console.log(res) 
						            }
						        ).then(function(){
						        	mui('#refreshContainer').pullRefresh().endPulldownToRefresh();   
						        });
						}
					})
                        
				}
			})

		</script>
	</body>

</html>